import Vue from 'vue'
import VueRouter from 'vue-router'

const Login = () => import('../components/login/Login')
const Home = () => import('../components/home/Home')
const index = () => import('../components/home/index/index')
const shortRent = () => import('../components/shortRent/shortRent')
const longRent = () => import('../components/longRent/longRent')
const personalityRent = () => import('../components/personalityRent/personalityRent')
const becomeTheOwner = () => import('../components/becomeTheOwner/becomeTheOwner')
const enterpriseCarRental = () => import('../components/enterpriseRent/enterpriseRent')
const merchantsIn = () => import('../components/merchantsIn/merchantsIn')
const aboutUs = () => import('../components/aboutUs/aboutUs')
const AMG = () => import('../components/carDetail/AMG')
const CLS = () => import('../components/carDetail/CLS')
const Panamera = () => import('../components/carDetail/Panamera')
const MODEL_X = () => import('../components/carDetail/MODEL_X')

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home,
    redirect: '/index',
    children: [
      {
        path: '/index',
        component: index
      },
      {
        path: '/shortRent',
        component: shortRent
      },
      {
        path: '/longRent',
        component: longRent
      },
      {
        path: '/personalityRent',
        component: personalityRent
      },
      {
        path: '/becomeTheOwner',
        component: becomeTheOwner
      },
      {
        path: '/enterpriseCarRental',
        component: enterpriseCarRental
      },
      {
        path: '/merchantsIn',
        component: merchantsIn
      },
      {
        path: '/aboutUs',
        component: aboutUs
      },
      {
        path: '/carDetail/AMG',
        component: AMG
      },
      {
        path: '/carDetail/CLS',
        component: CLS
      },
      {
        path: '/carDetail/Panamera',
        component: Panamera
      },
      {
        path: '/carDetail/MODEL_X',
        component: MODEL_X
      }

    ]
  },

  {
    path: '/login',
    component: Login
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
